<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="com.CGFrame.struts.POJOs.Project" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Report Test</title>
	<LINK href="styles/sciencee.css"  type=text/css rel=stylesheet>
	<script language="javaScript" src="js/calendar.js"></script>
	<script language=javascript>
		function sub1(){
			var beginDate=document.getElementById("begin").value;
			var endDate=document.getElementById("end").value;
			
			var bymd=beginDate.split("-");
			var bdate=new Date(bymd[0],bymd[1],bymd[2]);
			
			var eymd=endDate.split("-");
			var edate=new Date(eymd[0],eymd[1],eymd[2]);
			if(bdate.getTime()>edate.getTime()){
				alert("结束日期早于开始日期");
				return;
			}
			document.getElementById("project1").value=document.getElementById("select1").value;
			document.getElementById("form1").submit();
		}
		function sub2(){
			var beginDate=document.getElementById("begin2").value;
			var endDate=document.getElementById("end2").value;
			
			var bymd=beginDate.split("-");
			var bdate=new Date(bymd[0],bymd[1],bymd[2]);
			
			var eymd=endDate.split("-");
			var edate=new Date(eymd[0],eymd[1],eymd[2]);
			if(bdate.getTime()>edate.getTime()){
				alert("结束日期早于开始日期");
				return;
			}
			document.getElementById("project2").value=document.getElementById("select1").value;
			document.getElementById("form2").submit();
		}
	</script>
</head>
<body>
	选择项目：
	<%List list=(List)request.getAttribute("projects"); %>
	<select id="select1"><option value="all">所有项目</option>
	<%for(Iterator iter=list.iterator();iter.hasNext();){
			Project project=(Project)iter.next();
	 %>
		<option value="<%=project.getProjectId() %>"><%=project.getProjectName() %></option>
	<%} %>
	</select>
	<br>
	完成工作报表：<br>
	<form id="form1" action="finishedReport.do" method="POST">
		开始日期:<input id="begin" type="text" name="begin" readOnly onClick="showcalendar(event, this)"><br>
		结束日期:<input id="end" type="text" name="end" readOnly onClick="showcalendar(event, this)">
		<input type="hidden" name="projectId" id="project1">
		<input type="button" onclick="sub1();" value="查询">
	</form>
	<br>
	<br>
	任务完成情况报表：<br>
	<form id="form2" action="workingReport.do" method="POST">
		开始日期:<input id="begin2" type="text" name="begin" readOnly onClick="showcalendar(event, this)"><br>
		结束日期:<input id="end2" type="text" name="end" readOnly onClick="showcalendar(event, this)">
		<input type="hidden" name="projectId" id="project2">
		<input type="button" onclick="sub2();" value="查询">
	</form>
</body>
</html>